{% extends layout %}

{% block title %}{{ dict_text('targetName', type) }}订单管理 - {{ parent() }}{% endblock %}

{#
    {% set script_controller = 'trade/index' %}
#}

{% set menu = 'order' %}

{% block main %}

  <div class="page-header clearfix">
    <h1>{{ dict_text('targetName', type) }}订单管理</h1>
  </div>

  <form id="user-search-form" class="form-inline well well-sm" action="" method="get" novalidate>
    <div class="form-group">
      <select class="form-control" name="status">
        {{ select_options(dict('orderStatus'), request.get('status'), '订单状态') }}
      </select>
    </div>

    <div class="form-group">
      <select class="form-control" name="payment">
        {{ select_options(dict('payment'), request.get('payment'), '支付方式') }}
      </select>
    </div>

    <div class="form-group" style="display:none;">
      <input class="form-control" type="text" name="paidTimeRange", placeholder="付款时间段">
    </div>

    <span class="divider"></span>

    <div class="form-group">
      <select class="form-control" name="keywordType">
        {% set options = {sn: '订单号', buyer:'购买者用户名', targetId: dict_text('targetName', type) ~ '编号'} %}
        {{ select_options(options, request.get('keywordType')) }}
      </select>
    </div>

    <div class="form-group">
      <input class="form-control" type="text" name="keyword" value="{{ request.get('keyword') }}" placeholder="关键词">
    </div>

    <button class="btn btn-primary">搜索</button>

  </form>
      
  <table class="table table-striped table-hover" id="order-table">
    <thead>
      <tr>
        <th width="50%">名称</th>
        <th>状态</th>
        <th>价格(元)</th>
        <th>购买者</th>
        <th>付款方式</th>
        <th>操作</th>
      </tr>
    </thead>
    <tbody>
      {% for order in orders %}
        {% set buyer = users[order.userId]|default(null) %}
        {% include 'TopxiaAdminBundle:Order:tr.html.twig' %}
      {% else %}
        <tr><td colspan="20"><div class="empty">暂无订单记录</div></td></tr>
      {% endfor %}
    </tbody>
  </table>

  <div class="paginator">
    {{ web_macro.paginator(paginator) }} 
  </div>


{% endblock %}
